Solid-state drives (“SSDs”) are one example of a storage device that stores data in non-volatile memory, such as NAND flash memory (commonly referred to as just “flash memory”). Flash memory stores information in an array of floating-gate transistors or cells. These transistors are organized into pages, and the pages are organized into memory blocks. A block may comprise a certain number of pages, and each page may comprise a certain amount of data. As one example, there may be 64 pages in one block, and 4 KB of data in each page. These numbers may vary based on the manufacturer of the SSD.
The technical nature of flash memory imposes several operational requirements. For example, the page can be the smallest unit of the memory in which data may be programmed (i.e., either written to or read from), and the block can be the smallest unit in which data may be erased. Data can only be written to empty pages. Therefore, writing new data to a page already storing data (e.g., invalid data) first requires erasing the invalid data.
However, because data within flash memory is erased on a per-block basis, it is not possible to overwrite data on a per-page basis. From an operational standpoint, a block should first be erased before any of its pages are reused to store any new data.
Additionally, an SSD containing flash memory does not provide full access to the physical flash memory locations. Instead, communicating with flash memory requires use of a storage interface that is presented to an external application (e.g., an operating system in a host). Communicating with the interface requires use of logical addresses that are then translated into physical addresses corresponding to physical locations in the flash memory.
This level of indirection creates an interesting scenario during deletion operations. When an operating system removes a file, the operating system does not actually remove the data corresponding to the file from the flash memory. Instead, the operating system simply removes the logical address(es) associated with the deleted file but leaves intact anything that corresponds to the physical location(s) where the data is (still) currently stored in the flash memory. Therefore, while the operating system believes the file to be deleted, the data for that file still exists in the flash memory. The flash memory is not aware that operating system has deleted the file, and is not aware that the data stored in its blocks are no longer valid.
When an operating system attempts to write new data to an occupied physical location(s) that it believes is available (e.g., at the location of the deleted file), the new data is actually written to a different empty physical location in flash memory. The operating system's attempt to write the new data to the occupied physical location signals the flash memory that the actual data located at that location is no longer in use. In other words, the flash memory typically only becomes aware of invalid data located at a physical location when the operating system attempts to write new data to that particular physical location. At this point, the flash memory may then invalidate the data at that physical location.
To address these issues, one command that is typically employed with storage systems that employ flash memory is a data invalidation command. A data invalidation command acts as a signal from the operating system that a range of logical addresses are no longer needed because the file associated with that range has been deleted by the operating system. The flash memory therefore does not need to wait until the operating system attempts to write new data but may preemptively invalidate the data.
The operating system sends the data invalidation command to the flash memory when the operating system deletes a file(s). Based on the data invalidation command, the flash memory is notified as to which pages are now storing invalid data and that do not need to be included when the flash memory next performs garbage collection. Garbage collection refers to the process where flash memory periodically performs maintenance on its blocks by consolidating valid data pages into new blocks. Therefore, the purpose of the data invalidation command is to make the process of updating the flash memory with new data more efficient.
However, the time to execute a data invalidation command can take an extensive amount of time, especially for when data invalidation commands impact a large number of physical addresses. As part of the execution of the data invalidation command, the flash memory must also perform other processes and steps. The amount of time to perform these other processes and steps increases as the number of impacted addresses increases.
As the storage capacity of flash-based memory devices increases, the increased number of blocks that are impacted by a data invalidation command will burden conventional controllers for these higher capacity memory devices. Therefore, the length of time for executing data invalidation commands will only increase as storage capacity increases.
As can be seen, conventional SSDs are rigidly implemented because their controllers cannot adjust the execution of data invalidation commands. There is a long felt need for an improved storage device that executes the data invalidation command in a more efficient and flexible manner.